home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / umich / falcon / programm.ing / falclib6.lzh / EXAMPLE / TRUEGEM.S < prev   
Text File  |  1994-08-23  |  4KB  |  186 lines

  1. *********************************************************
  2. *                            *
  3. * A window demonstration                *
  4. *                            *
  5. * Swirling colours in a gem window.            *
  6. *                            *
  7. *********************************************************
  8.  
  9.         include    releasem.s    release unused memory
  10.         include    getpar.s    find where the parameters are kept
  11.         move.l    a0,parbuf    save it
  12.  
  13.         bra    main
  14.         include    gemmacro.i    this one is supplied with devpac
  15.         include    shrtones.s
  16.         include    window.s
  17.         include    gem.s
  18.  
  19. wtype        equ    %100100101011        sizebox, info, move, full, close and name
  20. windowname    dc.b    'True Colours',0
  21.  
  22. main        move    #-1,-(sp)
  23.         @xbios    $58,4
  24.         and    #$7,d0
  25.         cmp    #4,d0
  26.         bne    not_tc
  27.  
  28.         move    #32,xstart    window start position
  29.         move    #50,ystart
  30.         move    #190,xwidth    window size
  31.         move    #80,ywidth
  32.         bsr    @createwindow
  33.  
  34.         menu_register ap_id,#applname    ; set the name of the application
  35.  
  36. wait        evnt_multi #%110010,#1,#1,#1,#0,#0,#0,#0,#0,#0,#0,#0,#0,#0,#msgbuf,#40    ;get message and button events
  37.         btst.b    #4,int_out+1
  38.         bne    msgevent
  39. msgready    btst.b    #5,int_out+1
  40.         bne    timerevent
  41. timerready    btst.b    #1,int_out+1
  42.         bne    buttonevent
  43.         bra    wait
  44.         
  45. msgevent    move    msgbuf,d0
  46.         cmp    #20,d0        is it an update event?
  47.         beq    redraw
  48.         cmp    #22,d0        was the close box pressed?
  49.         beq    exit
  50.         cmp    #27,d0
  51.         beq    sized
  52.         cmp    #28,d0        was the window moved?
  53.         beq    moved
  54.         cmp    #23,d0        was the full button pressed
  55.         beq    full
  56.         cmp    #21,d0        was the window topped?
  57.         beq    topped
  58.         cmp    #33,d0        was it bottomed?
  59.         beq    bottomed
  60.         bra    msgready    it was something unimportant
  61.         
  62. buttonevent    bra    wait        nothing of importance was clicked on
  63.     
  64. timerevent    bsr    update
  65.         bra    timerready
  66.  
  67. exit        bsr    @exitwindow
  68.         bra    @quit
  69.  
  70. redraw        bsr    update
  71.         bra    msgready
  72.     
  73. moved        lea    msgbuf,a0
  74.         bsr    @moveit
  75.         bra    msgready
  76.         
  77. sized        lea    msgbuf,a0
  78.         bsr    @resizewindow
  79.         bra    msgready
  80.     
  81. bottomed    lea    msgbuf,a0
  82.         bsr    @bottomwindow
  83.         bra    msgready
  84.     
  85. topped        lea    msgbuf,a0
  86.         bsr    @topwindow
  87.         bra    msgready
  88.  
  89. full        bra    msgready
  90.         
  91. update        wind_update #1
  92.         @xbios    3,2
  93.         move.l    d0,a1
  94.         move    colour,d0
  95.         move    d0,d2
  96.         swap    d0
  97.         move    d2,d0
  98.         move    xwidth,d1
  99.         lsr    #1,d1
  100.         add    #2,d1
  101.         add    d1,colour
  102.  
  103.         movem.l    d0/a1,-(sp)
  104.         wind_get w_handle,#11
  105.         tst.w    int_out+6
  106.         bne    .next
  107.         tst.w    int_out+8
  108.         beq    .out
  109.         
  110. .next        movem.l    (sp)+,d0/a1
  111.         move.l    a1,a0
  112.         move    int_out+2,d2
  113.         bge    .notneg
  114.         add    d2,int_out+6
  115.         move    #0,int_out+2
  116.         bra    .x2ok
  117. .notneg        add    int_out+6,d2
  118.         sub    screenxmax,d2
  119.         ble    .x2ok
  120.         sub    d2,int_out+6
  121.         ble    .dontdraw
  122. .x2ok        move    int_out+4,d2
  123.         add    int_out+8,d2
  124.         sub    screenymax,d2
  125.         ble    .y2ok
  126.         sub    d2,int_out+8
  127.         ble    .dontdraw
  128. .y2ok        move    int_out+2,d1
  129.         lsl    #1,d1
  130.         ext.l    d1
  131.         add.l    d1,a0
  132.         move    int_out+4,d2
  133.         move    screenxmax,d5
  134.         add    #1,d5
  135.         add    d5,d5
  136.         mulu    d5,d2
  137.         add.l    d2,a0
  138.         move    int_out+6,d4
  139.         lsr    #1,d4
  140.         sub    #1,d4
  141.         move    int_out+8,d2
  142.         sub    #1,d2
  143.         move    screenxmax,d5
  144.         add    #1,d5
  145.         add    d5,d5
  146.         move    d5,d3
  147.         move    d4,d1
  148.         addq    #1,d1
  149.         lsl    #2,d1
  150.         sub    d1,d3
  151.         bsr    newline
  152. .dontdraw    movem.l    d0/a1,-(sp)
  153.         
  154.         wind_get w_handle,#12
  155.         tst.w    int_out+6
  156.         bne    .next
  157.         tst.w    int_out+8
  158.         bne    .next
  159. .out        movem.l    (sp)+,d0/a1
  160.         wind_update #0
  161.         rts
  162.  
  163. newline        move    d4,d1
  164. dopix        move.l    d0,(a0)+
  165.         add.l    #$10001,d0
  166.         dbra    d1,dopix
  167. pixready    add.l    d3,a0
  168.         dbra    d2,newline
  169.         rts
  170.         
  171. not_tc        form_alert #1,#alerttext
  172.         bra    @quit
  173.  
  174.  
  175. colour        dc.w    $40d3
  176. applname    dc.b    '  True Colours',0
  177. alerttext    dc.b    '[1][ True Colour only][oooh]',0
  178.  
  179.         include    aeslib.s    supplied with devpac
  180.         include    vdilib.s    supplied with devpac
  181.         
  182.         section bss
  183.  
  184. msgbuf        ds.w    20
  185. parbuf        ds.l    1
  186.